package com.hfzy.ihk.web.freeswitchManage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hfzy.ihk.facade.freeswitchManage.entity.Aliases;
import com.hfzy.ihk.facade.freeswitchManage.entity.BadCustomerPhone;
import com.hfzy.ihk.facade.freeswitchManage.entity.Gateway;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wws
 * @since 2018-12-29
 */
public interface BadCustomerPhoneMapper extends BaseMapper<BadCustomerPhone> {


    Integer count(@Param("params") Map<String, Object> params);

    List<BadCustomerPhone> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset,
                       @Param("limit") Integer limit);

    @Insert("insert into bad_customer_phone(bad_phone,source,remark,state,create_time) \n" +
            "        values(#{badCustomerPhone.badPhone},#{badCustomerPhone.source},#{badCustomerPhone.remark},1,SYSDATE())\n" +
            "        ON DUPLICATE KEY UPDATE \n" +
            "        source=values(source),state=1,update_time=SYSDATE(),remark=VALUES(remark),create_time=SYSDATE() ")
    Integer saveOrUpdate(@Param("badCustomerPhone") BadCustomerPhone badCustomerPhone);


    @Select("select * from bad_customer_phone where id = #{id}")
    BadCustomerPhone queryById(Integer id);

}
